<?php
namespace Home\Controller;
use Think\Controller;

class BzhhController extends Controller {
    public function index(){
        indexRvent();//测算首页执行事件
        $this->assign('titleName',titleName('Bzhh',1));//首页名称
        cookie('orderidnum','Bzhh');

        indexRequest($_REQUEST);//测算首页接收数据处理

        if($_REQUEST['discountQczh']){//趣测综合页优惠
            cookie('discountQczh',$_REQUEST['discountQczh']);
        }

        cnzz_pvuv('HH');//执行统计
        //渠道获取ID
        $channelID=obtain_channelID('HH');
        $this->assign('channelID',$channelID);

        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");
            if($_SERVER['HTTP_HOST']=='hy.yixueqm.com'){
                if($_REQUEST['openid']!=''){
                    cookie('openid',$_REQUEST['openid'],7100);
                    S('ticket',$_REQUEST['ticket'],7100);
                }
                $openid=cookie('openid');
                $wzurl=wxJsdkData();
                if(empty($openid)){
                    openidJump('Bzhh',cookie('channel'));
                }

                if(!empty($_REQUEST['code'])){
                    cookie('code',$_REQUEST['code'],7100);
                }
            }else{
                getToken();
                getTicket();
                if(!empty($_REQUEST['code'])){
                    cookie('code',$_REQUEST['code'],7100);
                }
                getCode($wzurl);
                getOopenid();
            }

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);

            wxShareUrl('HH','Bzhh');//分享地址获取
            cookie('uid',cookie('openid'));
        }

        if(!empty($_REQUEST['uid'])){
            cookie('uid',$_REQUEST['uid']);
        }else{
            $imei=cookie('imei');//生成唯一标识imei
            $uid=cookie('uid');
            if(empty($imei)){$imei=date('Ymd').mt_rand(10000,99999).date('His');cookie('imei',$imei);}
            if(empty($uid)){cookie('uid',$imei);}
        }

        //八字合婚随机数
        csRandNum('bzhhcs',400000,599999);

        //半价
        $jieguoye=$_REQUEST['jieguoye'];
        banjia($jieguoye);

        $this->assign('channel',cookie('channel'));
        $this->assign('share',1);
        $this->assign('wxlogin',cookie('wxlogin'));
        $this->assign('orderidnum',cookie('orderidnum'));
        $this->display("Bzhh/ZM_index");
       }
    public function bzhf_zhifu(){
        $this->assign('titleName',titleName('Bzhh',2,'HH'));//首页名称
        $strData=mb_substr(cookie('orderid'),0,2);
        if($strData=='QS')cookie('orderid',null);
        cookie('timeStrto',time()+7200);//倒计时时间戳
        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            if($_SERVER['HTTP_HOST']=='hy.yixueqm.com'){
            }else{
                getToken();
                getTicket();
            }
            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);
        }

        if($_REQUEST['username']){//返回操作
            cookie('zymd',mb_substr($_REQUEST['birthday'],2,10));
            cookie('zhour',mb_substr($_REQUEST['birthday'],13,2));
            cookie('znickname',I("post.username"));
            cookie('datetype',mb_substr($_REQUEST['birthday'],0,1));

            cookie('fymd',mb_substr($_REQUEST['girl_birthday'],2,10));
            cookie('fhour',mb_substr($_REQUEST['girl_birthday'],13,2));
            cookie('fdatetype',mb_substr($_REQUEST['girl_birthday'],0,1));
            cookie('fnickname',I("post.girl_username"));
        }
        if($_REQUEST['birthday']==''){
            $birthday='0-2018-08-08-8';
            cookie('zymd',$birthday);
        }

        if(!empty($_REQUEST['ordernum'])){
            $arrdata[0]=S('sm_h5test|'.$_REQUEST['ordernum']);
            $zymd=$arrdata[0]['year'].'-'.str_pad($arrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($arrdata[0]['day'],2,'0',STR_PAD_LEFT);
            cookie('zymd',$zymd,604800);
            cookie('zhour',$arrdata[0]['hour'],604800);
            cookie('znickname',$arrdata[0]['username'],604800);
            cookie('price',$arrdata[0]['price'],604800);
            cookie('datetype',$arrdata[0]['datetype']);

            $farrdata[0]=S('sm_h5test|'.$_REQUEST['ordernum'].'_');

            cookie('fymd',$farrdata[0]['year'].'-'.str_pad($farrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($farrdata[0]['day'],2,"0",STR_PAD_LEFT),604800);
            cookie('fhour',$farrdata[0]['hour'],604800);
            cookie('fnickname',$farrdata[0]['username'],604800);
            cookie('fdatetype',$arrdata[0]['datetype']);

            cookie('orderid',$_REQUEST['ordernum'],604800);
            if(cookie('price')=='9'){
                redirect(U('Bzhh/jieguoye','',false).'?share=1');exit;
            }
            cookie('orderidnum','Bzhh',604800);
        }


        $y=mb_substr(cookie('zymd'),0,4);//年
        $m=mb_substr(cookie('zymd'),5,2); //月
        $d=mb_substr(cookie('zymd'),8,2);//日
        $zyinli=yinli($y,$m,$d);
        cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时',604800);//阳历
        cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2],604800);//阴历

        $fy=mb_substr(cookie('fymd'),0,4);//年
        $fm=mb_substr(cookie('fymd'),5,2); //月
        $fd=mb_substr(cookie('fymd'),8,2);//日
        $fyinli=yinli($fy,$fm,$fd);
        cookie('fyangli',$fy.'年'.$fm.'月'.$fd.'日'.' '.cookie('fhour').'时',604800);//阳历
        cookie('fyinli',$fyinli[0].'年'.$fyinli[1].$fyinli[2],604800);//阴历

        $data=cookie('orderid');//获取订单号
        if(empty($data)&&empty($_REQUEST['ordernum'])){
            $orderid='HH'.date('Ymd').mt_rand(100,999).date('His');
            cookie('orderid',$orderid,604800);
        }


        //创建订单
        $hour=cookie('zhour');if($hour==''){$hour=1;}
        $fhour=cookie('fhour');if($fhour==''){$hour=1;}
        $shop=cookie('orderid');
        $znickname=cookie('znickname');
        $fnickname=cookie('fnickname');
        $datetype=cookie('datetype');if($datetype=='')$datetype=0;
        $fdatetype=cookie('fdatetype');if($fdatetype=='')$fdatetype=0;
        $channel=cookie('channel');
        $imei=cookie('uid');if(cookie('uid')==''){$imei=cookie('imei');}
        defaultPrice();

        channelPay($channel,'HH');//查询渠道价格

        if(cookie('couponPrice')){//是否有使用优惠券
            cookie('price',cookie('couponPrice'));
            $this->assign('discount',10);//优惠券价格
        }else{
            $this->assign('discount',0);//优惠券价格
        }

        if(cookie('discountQczh')){//是否有趣测优惠券
            $price=cookie('price');
            cookie('price',$price/2);
            $remark='discountQczh';
        }

        csPay($znickname,$channel);//测试价格判断

        $price=cookie('price');
        if(empty($_REQUEST['ordernum'])){
//            $arrdata=M()->query("select * from sm_h5test where ordernum='{$shop}'");
//            if(empty($arrdata)){
//                M()->query("insert into sm_h5test (ordernum,price,username,typeid,sex,status,datetype,year,month,day,hour,paykind,date_remark,appuserid,ip,channel)values(
//                                              '{$shop}','{$price}','{$znickname}',1,1,-1,{$datetype},{$y},{$m},{$d},'{$hour}',-1,'{$remark}','{$imei}','{$_SERVER['REMOTE_ADDR']}','{$channel}')");
//                M()->query("insert into sm_h5test (ordernum,price,username,typeid,sex,status,datetype,year,month,day,hour,paykind,date_remark,appuserid,ip)values(
//                                              '{$shop}_',0,'{$fnickname}',1,0,-1,{$fdatetype},{$fy},{$fm},{$fd},'{$fhour}',-1,'{$imei}','{$imei}','{$_SERVER['REMOTE_ADDR']}')");
//                $IndexController=A('Index');
//                $IndexController->subNumber('HH');
//            }
//            if(!cookie($_REQUEST['username'])){//返回操作
//                //更新订单
//                M()->query("update sm_h5test set username='{$znickname}',year={$y},month={$m},day={$d} where ordernum='{$shop}'");
//                M()->query("update sm_h5test set username='{$fnickname}',year={$fy},month={$fm},day={$fd} where ordernum='{$shop}_'");
//            }

            $arrdata=S('sm_h5test|'.$shop);
            $Farrdata=S('sm_h5test|'.$shop.'_');
            if(empty($arrdata)){
                $smH5testinter=array(
                    'ordernum'=>$shop, 'price'=>$price, 'username'=>$znickname, 'typeid'=>1, 'sex'=>1, 'createtime'=>date('Y-m-d H:i:m'), 'status'=>-1,
                    'datetype'=>$datetype, 'year'=>$y, 'month'=>$m, 'day'=>$d, 'hour'=>$hour, 'date_remark'=>$remark, 'appuserid'=>$imei, 'ip'=>$_SERVER['REMOTE_ADDR'],
                    'channel'=>$channel, 'auto_send_sms'=>0, 'place'=>0, 'paykind'=>-1
                );
                $FsmH5testinter=array(
                    'ordernum'=>$shop.'_', 'price'=>0, 'username'=>$fnickname, 'typeid'=>1, 'sex'=>0, 'createtime'=>date('Y-m-d H:i:m'), 'status'=>-1,
                    'datetype'=>$fdatetype, 'year'=>$fy, 'month'=>$fm, 'day'=>$fd, 'hour'=>$fhour, 'appuserid'=>$imei, 'ip'=>$_SERVER['REMOTE_ADDR'],
                    'channel'=>$channel, 'auto_send_sms'=>0, 'place'=>0, 'paykind'=>-1
                );
                S('sm_h5test|'.$shop,$smH5testinter,2592000);//2592000为30天
                cacheZhiFuOrderid($shop);//支付页缓存订单操作
                S('sm_h5test|'.$shop.'_',$FsmH5testinter,2592000);//2592000为30天
                cacheZhiFuOrderid($shop.'_');//支付页缓存订单操作

                $IndexController=A('Index');
                $IndexController->subNumber('HH');
            }else if(!cookie($_REQUEST['username'])) {//返回操作
                //更新订单
                $arrdata['username']=$znickname;$arrdata['datetype']=$datetype;$arrdata['year']=$y;$arrdata['month']=$m;$arrdata['day']=$d;
                S('sm_h5test|'.$shop,$arrdata,2592000);//2592000为30天
                $Farrdata['username']=$fnickname;$Farrdata['datetype']=$fdatetype;$Farrdata['year']=$fy;$Farrdata['month']=$fm;$Farrdata['day']=$fd;
                S('sm_h5test|'.$shop.'_',$Farrdata,2592000);//2592000为30天
            }
        }


        zwmp(cookie('zymd'), cookie('zhour'),'男','sizhu');
        $sizhu=I('globals.sizhu');
        $this->assign('sizhu',$sizhu);//Z四柱
        if($datetype==1){
            $this->assign('datetype',"农历 ".cookie('zyinli')." ".mb_substr($sizhu[3],1,1,'utf-8')."时");
        }else{
            $this->assign('datetype',"阳历 ".cookie('zyangli'));
        }

        zwmp(cookie('fymd'), cookie('fhour'),'女','sizhu');
        $sizhu=I('globals.sizhu');
        $this->assign('fsizhu',$sizhu);//Z四柱
        if($datetype==1){
            $this->assign('fdatetype',"农历 ".cookie('fyinli')." ".mb_substr($sizhu[3],1,1,'utf-8')."时");
        }else{
            $this->assign('fdatetype',"阳历 ".cookie('fyangli'));
        }


        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            if (strpos($user_agent, 'Windows') == true||strpos($user_agent,'Mac') == true) {
                //Windows 电脑访问
                if(channelSaoma($channel)){
                    $this->assign('pc',1);
                    $saomaUrl=wxsaoma('HH','八字合婚',cookie('orderid'));//微信扫码回调参数
                    $this->assign('wxsaoma',$saomaUrl);
                }
            }
        }else{

            $xml=wxgzhzf('HH','八字合婚',cookie('orderid'));//公众号支付回调参数
            $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
            $val = json_decode(json_encode($xmlstring),true);
            $noncestr=noncestr(15);//随机字符串
            $timestamp=time();//时间戳

            $stringA="appId=".cookie('APPID')."&nonceStr={$noncestr}&package=prepay_id={$val['prepay_id']}&signType=MD5&timeStamp={$timestamp}";
            $stringSignTemp=$stringA."&key=".cookie('wxKEY');
            $sign=strtoupper(md5($stringSignTemp));

            $this->assign('timeStamp',$timestamp);
            $this->assign('nonceStr',$noncestr);
            $this->assign('package','prepay_id='.$val['prepay_id']);
            $this->assign('signType','MD5');
            $this->assign('paySign',$sign);
            $this->assign('appId',cookie('APPID'));

        }

        $this->assign('csNameJump',U('Bzhh/jieguoye','',false).'?ordernum='.cookie('orderid'));//支付成功跳转地址

        $this->assign('znickname',cookie('znickname'));
        $this->assign('fnickname',cookie('fnickname'));
        $this->assign('channel',cookie('channel'));
        $this->assign('orderidnum',cookie('orderidnum'));
        $this->assign('wxlogin',cookie('wxlogin'));
        $this->assign('orderid',cookie('orderid'));
        if(channeFree($channel)){
            $this->display('Bzhh/ZM_zhifu_free');
        }else{
            $this->display('Bzhh/ZM_zhifu');
        }
    }
    public function jieguoye(){
        jieguoInterface('Bzhh');//结果页公共函数
        $this->assign('titleName',titleName('Bzhh',3));//首页名称
        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。

        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            $this->assign('wxlogin',1);

            if($_SERVER['HTTP_HOST']==cookie('jieguoUrlYM')){

            }else{
                getToken();
                getTicket();
            }
            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);
        }


        if(empty($_REQUEST['ordernum'])){
            $zymd= cookie('zymd');
            $zhour= cookie('zhour');
        }else{
            $ordernum=$_REQUEST['ordernum'];
            $arrdata[0]=jieguoyeArrData($ordernum);

            $zymd=$arrdata[0]['year'].'-'.str_pad($arrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($arrdata[0]['day'],2,'0',STR_PAD_LEFT);
            cookie('zymd',$zymd,604800);
            cookie('zhour',$arrdata[0]['hour'],604800);
            $zhour=$arrdata[0]['hour'];
            cookie('znickname',$arrdata[0]['username'],604800);

            $farrdata[0]=S('sm_h5test|'.$ordernum.'_');
            if($farrdata[0]['appuserid']==''){
                $farrdata=M()->query("select * from sm_h5test where ordernum='{$_REQUEST['ordernum']}_'");
            }

            cookie('fymd',$farrdata[0]['year'].'-'.str_pad($farrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($farrdata[0]['day'],2,"0",STR_PAD_LEFT),604800);
            cookie('fhour',$farrdata[0]['hour'],604800);
            cookie('fnickname',$farrdata[0]['username'],604800);

            $y=mb_substr(cookie('zymd'),0,4);//年
            $m=mb_substr(cookie('zymd'),5,2); //月
            $d=mb_substr(cookie('zymd'),8,2);//日
            $zyinli=yinli($y,$m,$d);
            cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时',604800);//阳历
            cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2],604800);//阴历

            $fy=mb_substr(cookie('fymd'),0,4);//年
            $fm=mb_substr(cookie('fymd'),5,2); //月
            $fd=mb_substr(cookie('fymd'),8,2);//日
            $fyinli=yinli($fy,$fm,$fd);
            cookie('fyangli',$fy.'年'.$fm.'月'.$fd.'日'.' '.cookie('fhour').'时',604800);//阳历
            cookie('fyinli',$fyinli[0].'年'.$fyinli[1].$fyinli[2],604800);//阴历

            cookie('orderid',$arrdata[0]['ordernum'],604800);
        }


        //一对一亲算下单
        cookie('csTypePrice','288');//一对一价格
        $QSorder=new \Library\toolOrder();
        $wxzhifuArr=$QSorder->QSorderXD();
        if($wxzhifuArr==1){
            $this->assign('qsPay',1);
        }else{//更新数据hu
            if (strpos($user_agent, 'MicroMessenger') == false) {
                //非微信浏览器访问
            }else{
                $this->assign('timeStamp',$wxzhifuArr['timeStamp']);
                $this->assign('nonceStr',$wxzhifuArr['nonceStr']);
                $this->assign('package',$wxzhifuArr['package']);
                $this->assign('signType',$wxzhifuArr['signType']);
                $this->assign('paySign',$wxzhifuArr['paySign']);
                $this->assign('appId',$wxzhifuArr['appId']);
            }
        }


        if($zymd!=''){
            zwmp($zymd,$zhour,'男','zw');
            $this->assign('sizhu',I('globals.sizhu'));//Z四柱
            $this->assign('mgwz',I('globals.mgwz'));
            $this->assign('position',I('globals.position'));
            $this->assign('seespouse',I('globals.see-spouse'));
            $this->assign('ny',I('globals.ny'));
            $this->assign('wedlock',I('globals.wedlock'));
            $this->assign('jyfraction',I('globals.jyfraction'));

            $this->assign('yysex',I('globals.yysex'));
            $this->assign('tg',I('globals.tg'));
            $this->assign('srg',I('globals.srg'));
            $this->assign('wxj',I('globals.wxj'));

            $this->assign('zx',I('globals.zx')); $this->assign('fqzx',I('globals.fqzx'));
            $this->assign('tf',I('globals.tf')); $this->assign('fqtf',I('globals.fqtf'));
            $this->assign('syzx',I('globals.syzx')); $this->assign('fqsyzx',I('globals.fqsyzx'));
            $this->assign('snzx',I('globals.snzx')); $this->assign('fqsnzx',I('globals.fqsnzx'));
            $this->assign('mssnzx',I('globals.mssnzx'));
            $this->assign('sxzx',I('globals.sxzx')); $this->assign('fqsxzx',I('globals.fqsxzx'));
            $this->assign('sngx',I('globals.sngx')); $this->assign('fqsngx',I('globals.fqsngx'));
            $this->assign('snjq',I('globals.snjq'));
            $this->assign('snsq',I('globals.snsq'));
            $this->assign('snbs',I('globals.snbs'));
            $this->assign('cssex',I('globals.cssex'));
            $this->assign('dx',I('globals.dx'));
            $this->assign('qtx',I('globals.qtx'));
            $this->assign('xx',I('globals.xx'));
            $this->assign('shua',I('globals.shua'));
            $this->assign('lnlylr',I('globals.lnlylr'));
            $this->assign('shengxiao',I('globals.shengxiao'));
            $this->assign('datamgongwz',I('globals.datamgongwz'));//命宫位置

        }

        if(cookie('fymd')!=''){
            zwmp(cookie('fymd'),cookie('fhour'),'女','zw');
            $this->assign('fsizhu',I('globals.sizhu'));//F四柱
            $this->assign('fmgwz',I('globals.mgwz'));
            $this->assign('fposition',I('globals.position'));
            $this->assign('fseespouse',I('globals.see-spouse'));
            $this->assign('fny',I('globals.ny'));
            $this->assign('fwedlock',I('globals.wedlock'));
            $this->assign('fjyfraction',I('globals.jyfraction'));

            $this->assign('ftg',I('globals.tg'));
            $this->assign('fsrg',I('globals.srg'));
            $this->assign('fwxj',I('globals.wxj'));

            $this->assign('fzx',I('globals.zx')); $this->assign('ffqzx',I('globals.fqzx'));
            $this->assign('ftf',I('globals.tf')); $this->assign('ffqtf',I('globals.fqtf'));
            $this->assign('fsyzx',I('globals.syzx')); $this->assign('ffqsyzx',I('globals.fqsyzx'));
            $this->assign('fsnzx',I('globals.snzx')); $this->assign('ffqsnzx',I('globals.fqsnzx'));
            $this->assign('fmssnzx',I('globals.mssnzx'));
            $this->assign('fsxzx',I('globals.sxzx')); $this->assign('ffqsxzx',I('globals.fqsxzx'));
            $this->assign('fsngx',I('globals.sngx')); $this->assign('ffqsngx',I('globals.fqsngx'));
            $this->assign('fshua',I('globals.shua'));
            $this->assign('fshengxiao',I('globals.shengxiao'));
        }
        $nanwxj=I('globals.nanwxj');
        $nvwxj=I('globals.nvwxj');
        if($nanwxj!=''&&$nvwxj!=''){
            wxhp($nanwxj.$nvwxj);
            $this->assign('wxnn',I('globals.wxnn'));
            $this->assign('wxfraction',I('globals.wxfraction'));
        }

        $nansx=I('globals.nansx');
        $nvsx=I('globals.nvsx');
        if($nansx!=''&&$nvsx!=''){
            sxhp($nansx,$nvsx);
            $this->assign('sxnn',I('globals.sxnn'));
            $this->assign('sxfraction',I('globals.sxfraction'));
        }

        bzhh_fortune(I('globals.bzrizhu'),I('globals.fbzrizhu'));
        $bzhehun=bzhehun($zymd,cookie('fymd'));
        $this->assign('myarr',$bzhehun['myarr']);//命运合盘
        $mgjudge=$bzhehun['myarr']['mgjudge'];
        $this->assign('mzzd',$bzhehun['mzzd']);//命中注定
        $this->assign('xfxw',$bzhehun['xfxw']);//相扶相旺
        jiatingms(I('globals.bznianzhu'),$zymd,cookie('fymd'));
        $this->assign('jtmsarr',I('globals.jtmsarr'));//家庭模式
        $dayuntbnum=(cookie('zhour')==cookie('fhour'))?1:0;
        $this->assign('dayuntbnum',$dayuntbnum);//大运同步
        $zinvtbnum=((mb_substr(cookie('zymd'),0,4)+$fy+$fm+$fd)%2)?1:0;
        $this->assign('zinvtbnum',$zinvtbnum);//子女同步

        $this->assign('channel',cookie('channel'));
        $this->assign('orderidnum',cookie('orderidnum'));
        $this->assign('wxlogin',cookie('wxlogin'));

        if($mgjudge==1){//上吉
            $zongfen=($y+$m+$d+$fy+$fm+$fd)%12+84;
        }else{
            $zongfen=($y+$m+$d+$fy+$fm+$fd)%24+60;
        }
        $this->assign('zongfen',$zongfen);

        $this->display('Bzhh/ZM_jieguoye');
    }
    public function payzfEnd(){
        $this->assign('orderName','CY');
        $this->display('Index/payzfEnd');
    }

    public function hhzhifu(){
        $data=M()->query("select status from sm_h5test where ordernum='".cookie('orderid')."'");
        $this->assign('status',$data[0]['status']);
        $this->display("Index/ZM_hhzhifu");
    }

    public function pay(){
        $this->assign('ordername1','八字合婚');
        $this->assign('ordername2','知命-八字合婚');
        $this->display("Index/pay");
    }
    public function paywx(){
        H5ZMwxzhifu('HH','八字合婚',cookie('orderid'),'Bzhh');//知命
    }

    public function sharedata(){
        //S($data,0,304800);//清除值
        $data=cookie('uidshare');
        if(empty($data)){
            echo '0';
        }else{
            echo cookie('uidshare');
        }
    }


}